home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / gdd-pths.hqx / Paths / stack_-1.xml < prev   
Extensible Markup Language  |  1992-09-09  |  20KB  |  23 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>3</cardCount>
  7.     <cardID>4158</cardID>
  8.     <listID>2215</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>448</width>
  14.         <height>296</height>
  15.     </cardSize>
  16.     <script>-- These scripts ┬⌐ Alan Stenhouse 1992-- Department of Computer Science-- Massey University-- Palmerston North-- New Zealand-- Thanks due to Frederic Rinaldi for the use of his Textoid XCMD.-- Also thanks to the author of the XScrollBox XCMD.-- Unfortunately the textoid version is 3.1 which contains a bug-- to do with window placement. So when I get Textoid 3.2 I-- will incorporate it into this stack.on openCard-- this is so that every card that is visited gets added to the-- History list. But if a card or other stack already has an-- openCard handler then it won't be added.global myHistoryAddHistory (the short id of this cd), (the short name of this stack)end openCard-- on openStack-- global myPathName, myPalette-- if myPathName is empty then put "Test Paths" into myPathName-- if myPalette is empty then student-- end openStackon authorglobal myPaletteif there is a window myPalette then close window myPaletteput "Author" into myPalettepalette myPaletteend authoron studentglobal myPaletteif there is a window myPalette then close window myPaletteput "student" into myPaletteend studenton openPathglobal myPath, myMetaInfo, myHistory, currNodeNum, startTicks, myPathNameglobal myInfoWindow, myInfoRect, myDelim, infoEditStatus, myPalette, openPathStatus--load contents of this stack into global variableslock screenpush cdpop cd into myCurrCdset lockMessages to trueput "Information" into myInfoWindowput "30,30,200,120" into myInfoRectput "endNode" into myDelimput "FALSE" into infoEditStatus-- put "student" into myPalettestart using stack myPathName -- "Test Paths"  -- makes the scripts accessable from other stacksgetPathpalette myPalette-- -- now displayif openPathStatus = "cancel" thengo to myCurrCdelseput 0 into currNodeNumput the ticks into StartTicksif myPath is not empty thennextPath  -- this activates the next node in path handlerend if  -- which is located in the Home stack-- go to cd id (word 1 of line 1 of myPath)unlock screen-- set the information palette window position just-- to the right of the "Guided Paths" palette if it's thereif there is a window myPalette thenput (the right of window myPalette + 5) into myRightput (item 1 of myInfoRect + myRight) into item 1 of myInfoRectput (item 3 of myInfoRect + myRight) into item 3 of myInfoRectend ifend ifend openPathon getPath-- select a path to follow from the available paths stored in the Paths stackglobal myPathName, myPath, myHistory, myPathCard, myMetaInfo, myDelim, myPalette, PathStatus, openPathStatusput "Select the Path that you want to follow..." into listPromptpush cdpop cd into myCurrCdgo to stack myPathName-- get list of possible paths (i.e. cards in the stack)put empty into myPathList-- go to cd 2 of this stackgo to first cd of bg "Path"repeat with n = 1 to the number of cds of bg "Path"put the short name of this cd & return after myPathListgo next cd of bg "Path"end repeat-- now display the list of available paths and select one.-- Only allow "New" path if the palette is in Author modeput "  New  " into myButtonrepeat foreverif myPalette = "Author" thenput XScrollBox(1,listPrompt,myPathList, myButton) into tempPathCardelseput XScrollBox(1,listPrompt,myPathList) into tempPathCardend ifif tempPathCard is empty then  -- "Cancel" was pressed-- do nothing and exit repeat loopput "cancel" into openPathStatusexit repeatelseif item 1 of tempPathCard = myButton then  -- create a new pathask "Enter the new path name" with "New Path"if the result = "Cancel" thenput "cancel" into openPathStatusexit repeatelseif it is empty then -- do nothing and re-enter loopelseput it into myPathCardgo last cddoMenu "New Card"set the name of this cd to myPathCardput empty into myPathput myDelim into myMetaInfoput myDelim into bg fld "metainformation"put empty into myHistoryput "New" into PathStatusput "New" into openPathStatusexit repeatend ifend ifelse  -- OK was pressed and path was selectedif item 2 of tempPathCard is not empty then  -- path was selectedput item 2 of tempPathCard into myPathCardput bg fld "Path" of cd myPathCard into myPathput bg fld "metaInformation" of cd myPathCard into myMetaInfoput bg fld History of cd myPathCard into myHistoryput "Current" into openPathStatusexit repeatend ifend ifend ifend repeatend getPathon goToNode nodeNumber-- this goes to the node in the path that is identified by the parameter nodeNumberglobal myPathif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit goToNodeend ifput item 1 of line NodeNumber of myPath into myCardID -- get node IDput item 2 of line NodeNumber of myPath into myStack  -- get stack namego cd id myCardID of stack myStackif myCardID <> the short id of this cd thenanswer "Card id" && myCardID && "in stack" && myStack && "no longer exists." with "Ok"end ifend goToNode-- ΓÇóΓÇóΓÇóΓÇó The next few handlers should go in the Home stack so that ΓÇóΓÇóΓÇóΓÇó-- they can be accessed from any stack.-- The handlers to go in the Home stack to be accessed from the-- TrailBlazer palette are:-- metaInfo, nextPath, PrevPath, lastPath, AddPath, DeletePath, openPath, savePathon updateInfo newNodeNum, myNodeNum-- This updates the meta-information window when a new node is accessed-- so that it displays the meta-information for hte right node.global myMetaInfo, myInfoWindow, infoEditStatusif there is a window myInfoWindow thenif infoEditStatus = "TRUE" thenput the text of window myInfoWindow into myInfoinsertInfo myNodeNum, myInfoset the lockText of window myInfoWindow to trueput "FALSE" into infoEditStatusend ifput parseInfo(newNodeNum) into myInfo-- if myInfo is empty then-- closeInfoWindow     -- may be better to display the blank window-- and let the user close it. The user should have control.-- elseset text of window myInfoWindow to myInfo-- end ifend ifend updateInfoon metaInfo-- parse the metaInformation field to put meta-information window-- on the screen, using an external windowglobal currNodeNum, myMetaInfo, myInfoWindow, myInfoRect, myPalette, myPathlock screenif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit metainfoend ifif currNodeNum = 0 thenanswer "Can not add or display information until you have added a node." with "Ok"exit metaInfoend ifput parseInfo(currNodeNum) into myInfoif myInfo is empty then   -- can add some meta-infoif myPalette = "Author" thenanswer "Add some information for this node?" with "Cancel", "Add"if it = "Cancel" then-- do nothingelseAddMetaInfo currNodeNumend ifelseanswer "There is no meta-information for this node." with "Ok"end ifelsegoToNode currNodeNumtextoid myInfoWindow, myInfo, myInfoRect  -- courtesy F. Rinaldiend ifend metaInfoon AddMetaInfo nodeNumber-- This displays the meta-information window in edit mode so an author-- may enter meta-information for a node.global myMetaInfo, infoEditStatus, myInfoRect, myInfoWindow, currNodeNumlock screenput "TRUE" into infoEditStatus-- put empty into myInfo-- changed this in case we want to edit the info.put parseInfo(currNodeNum) into myInfotextoid myInfoWindow, myInfo, myInfoRectset the lockText of window myInfoWindow to falseunlock screenend AddMetaInfoon clicInText What,Where,Start,Stop,Font,Size,Style,Clr-- This close the meta-information window. The clicInText message-- is sent when the external window, created using the Textoid XCMD,-- is clicked in using the mouse. We could, perhaps, do other processing-- if desired, such as processing the text chunk clicked in for use as-- a hypertext link.closeInfoWindowend clicInTexton closeTextoid which-- This closes the meta-information window. First we must check--    that this message is sent from the meta-information window. If--    it isn't then we can pass it on.-- If the meta-information is being edited then we must save it--    for this node.global currNodeNum, myInfoWindow, infoEditStatusif which = myInfoWindow thenif infoEditStatus = "TRUE" thenget the text of window whichput it into myInfoinsertInfo currNodeNum, myInfoput "FALSE" into infoEditStatusend ifend ifsaveInfoRectend closeTextoidon insertInfo nodeNumber, myText-- This inserts meta-information into the correct position in the--    meta-information structure. It must parse the structure and count--    the occurences of the delimiter to determine the correct position.global myMetaInfo, myDelimif NodeNumber = 0 thenput myDelim & return & myDelim into myMetaInfoelseput nodeNumber - 1 into prevNodeput 0 into xput 0 into thisNoderepeat foreverput x + 1 into xif (line x of myMetaInfo) = myDelim thenif thisNode = prevNode thenput return & myText after line x of myMetaInfoexit repeatelseput thisNode + 1 into thisNodeend ifend ifend repeatend ifend insertInfoon closeInfoWindowglobal myInfoWindowif there is a window myInfoWindow thenclose window myInfoWindowend ifend closeInfoWindowon saveInfoRect-- this saves the last position of the meta-information window-- so that it can be re-opened in the same position as last time.global myInfoWindow, myInfoRectput the globalRect of window myInfoWindow into myInfoRectend saveInfoRectfunction parseInfo nodeNumber-- This function returns text which corresponds to a node number.-- The text for all nodes is in the memory variable myMetaInfo.-- The delimiters separating each node's text is the word "endNode".---- This function returns an empty string if there is no information-- for the current node.global myMetaInfo, myDelimif nodeNumber = 0 then return emptyput 20 into infoLimitput empty into myInfoput nodeNumber - 1 into prevNodeput 0 into xput 0 into targetNoderepeat foreverput x + 1 into xif (line x of myMetaInfo) = myDelim thenif targetNode <> prevNode thenput targetNode + 1 into targetNodeelserepeat foreverput x + 1 into xif line x of myMetaInfo <> myDelim thenput line x of myMetaInfo & return after myInfoelseexit repeatend ifend repeatexit repeatend ifend ifend repeatreturn myInfoend parseInfoon deleteMetaInfo nodeNum-- Delete the metainformation for a node.-- Note that we must also delete the 2nd delimiter.global myMetaInfo, myDelimput 1 into lineNumput 0 into myNoderepeat foreverif line lineNum of myMetaInfo = myDelim thenput myNode + 1 into myNodeif myNode = nodeNum thenput lineNum + 1 into lineNumrepeat foreverif line lineNum of myMetaInfo <> myDelim thendelete line lineNum of myMetaInfoelseexit repeatend ifend repeatdelete line lineNum of myMetaInfo  -- delete the 2nd delimiterexit repeatend ifend ifput lineNum + 1 into lineNumend repeatend deleteMetaInfoon nextPath-- this takes the user to the next node in the path-- if the user is at the last node then display a message-- add the previous node to the history list-- myPath contains the contents of the current Path-- myHistory contains the current user's history-- currNodeNum contains the line number of the current Node-- startTicks contains the start time that this node was begunglobal currNodeNum, myPath, startTickslock screenset lockMessages to trueput "visual effect wipe left" into visualEffectif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit nextPathend ifif currNodeNum > 0 then-- update history listAddHistory (the short id of this cd), (the short name of this stack)end ifif currNodeNum = the number of lines in myPath thenanswer "End of path reached." with "Ok"else-- now go to next nodeput currNodeNum + 1 into currNodeNum  -- increments path node countergoToNode currNodeNumupdateInfo currNodeNum, currNodeNum -1end ifput the ticks into startTicksunlock screen with visualEffectend nextPathon prevPath-- This takes the user to the previous node in the path.-- If the user is at the first node then display a message.-- Add the previous node to the history list-- myPath contains the contents of the current Path-- myHistory contains the current user's history-- currNodeNum contains the line number of the current Node-- startTicks contains the start time that this node was begunglobal currNodeNum, startTicks, myPathlock screenif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit prevPathend ifset lockMessages to trueput "visual effect wipe right" into visualEffectif currNodeNum > 0 then-- update history listAddHistory (the short id of this cd), (the short name of this stack)end ifif currNodeNum > 1 then-- now go to prev nodeput currNodeNum - 1 into currNodeNum  -- increments path node countergoToNode currNodeNumupdateInfo currNodeNum, currNodeNum +1elseanswer "Already at the beginning of the path." with "Ok"end ifput the ticks into startTicksunlock screen with visualEffectend prevPathon lastPath-- Jump back to the current node in the path.-- This should be used when a user has made a diversion and wants-- to get back to the current node directly.global currNodeNum, myPathlock screenif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit lastPathend ifset lockMessages to trueput "visual effect iris close" into visualEffectAddHistory (the short id of this cd), (the short name of this stack)goToNode currNodeNumunlock screen with visualEffectend lastPathon deletePath-- Delete a node from the path.-- Go to the node to be deleted and confirm deletion first.-- If confirmed then--    delete this node from the path--    do associated details such as decrementing the current node number--    then go to the node after (or before, if at last node) the deleted nodeglobal currNodeNum, myPathlock screenif myPath is empty thenanswer "No path is open or there are no nodes in the path."exit deletePathend ifset lockMessages to truegoToNode currNodeNumunlock screen          -- to update the screen for the userlock screenanswer "Are you sure you want to delete the current node?" ┬¼with "Cancel", "Delete"if it is "Cancel" then exit deletePathif it is "Delete" thendelete line currNodeNum of myPathdeleteMetaInfo currNodeNum-- check if the node we deleted was the last node.-- if it was then go to the previous nodeif currNodeNum > the number of lines in myPath thenput currNodeNum - 1 into currNodeNumend ifgoToNode currNodeNum         -- this will take the user to the next-- node in the path or the previous one if the last node was deletedend deletePathon AddPath-- This adds a new node to the current Path.-- Add the previous node to the history list.-- We might want to search the path structure to see if the current-- node is in the path already - although not really necessary-- as we might want to visit the same node twice.--    myPath contains the contents of the current Path--    myHistory contains the current user's history--    currNodeNum contains the line number of the current Node--    startTicks contains the start time that this node was begunglobal myPath, myHistory, currNodeNum, startTicks, myDelim, myInfoWindowif there is a window myInfoWindow then close window myInfoWindowput the short id of this card into myCardput the short name of this stack into myStackif currNodeNum = 0 thenput myCard & "," & myStack & return into myPathput myDelim into myMetaInfoelseif currNodeNum >= the number of lines in myPath thenput myCard & "," & myStack & return after myPathelse-- insert nodeput return & myCard & "," & myStack after line currNodeNum of myPathend ifend ifAddHistory (the first item of line currNodeNum of myPath), (the second item of line currNodeNum of myPath)put currNodeNum + 1 into currNodeNumInsertInfo currNodeNum, myDelim      -- this makes room for the new node'e meta-ionfoend AddPathon savePath-- This will save the current path and it's history.-- We can create a new path card or overwrite the current one.global myPathName, myPath, myHistory, myPathCard, myMetaInfo, PathStatus-- overwrite existing path?if PathStatus <> "New" thenanswer "Overwrite current path" && myPathCard & "?" with "Cancel", "Overwrite", "New"elseanswer "Save current path" && myPathCard & "?" with "Cancel", "Save"end iflock screenif it is "Cancel" then exit savePathif it is "New" thengo to last cd of stack myPathNamedoMenu "New Card"ask "Please Enter the name of this new path..." with "New Path"if ((it is empty) or (the result = "Cancel")) thenexit savePathelseset the name of this cd to itput it into bg fld "Path Name"put it into myPathCardend ifelse  -- it is "Overwrite" or "Save"go to cd myPathCard of stack myPathNameend ifput myPath into bg fld "Path"put myMetaInfo into bg fld "MetaInformation"put myHistory into bg fld "History"-- now path has been saved then we must overwrite it next timeput empty into PathStatusend savePathon AddHistory myCard, myStack-- This saves the current card details to the History structure.global myHistory, startTicksput the ticks into endTicksput (endTicks - startTicks) / 60 into elapsedTimeput the short time into myTimeput myCard & "," & myStack & "," & myTime & "," & elapsedTime & return after myHistoryput the ticks into startTicksend AddHistoryon createPathMenuif there is a menu "Paths" then exit createPathMenucreate menu "Paths"put createPathMenuItems() into menu "Paths" with menuMsg createPathMenuMsgs()disable menuItem 5 of menu "Paths"disable menuItem 8 of menu "Paths"end createPathMenufunction createPathMenuItemsreturn "Next" & return & ┬¼"Previous" & return & ┬¼"Information" & return & ┬¼"Jump back" & return & ┬¼"-" & return & ┬¼"Add" & return & ┬¼"Delete" & return & ┬¼"-" & return & ┬¼"Open..." & return & ┬¼"Save" & returnend createPathMenuItemsfunction createPathMenuMsgsreturn "NextPath" & return & ┬¼"PrevPath" & return & ┬¼"metaInfo" & return & ┬¼"lastPath" & return & ┬¼"" & return & ┬¼"addPath" & return & ┬¼"deletePath" & return & ┬¼"" & return & ┬¼"openPath" & return & ┬¼"savePath"end createPathMenuMsgson UpdateMenu myItems, itemStatusif there is not a menu "Paths" then exit UpdateMenurepeat with x = 1 to the number of items in myItemsput item x of myItems into myMenuItemdo itemStatus && "menuitem" && myMenuItem && "of menu Paths"end repeatend UpdateMenu</script>
  17.     <background id="2778" file="background_2778.xml" name="Path" />
  18.     <background id="3922" file="background_3922.xml" name="" />
  19.     <card id="4158" file="card_4158.xml" marked="false" name="" owner="3922" />
  20.     <card id="3785" file="card_3785.xml" marked="false" name="Master Path Card" owner="2778" />
  21.     <card id="5003" file="card_5003.xml" marked="false" name="Owls" owner="2778" />
  22. </stack>
  23.